Completed
Pull Request — master (#66)
by
unknown
02:44
created

removeRootPath.js ➔ removeRootPath   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 6
rs 9.4285
1
import Handlebars from 'handlebars'
2
3
/**
4
 * Handlebars helper, remove config.root from array of path
5
 */
6
export default function removeRootPath(obj, url, formater) {
7
  obj = JSON.parse(JSON.stringify(obj).replace(new RegExp(JSON.parse(url).root, 'g'), ''))
8
  obj = Handlebars.helpers[formater](obj)
9
	
10
  return obj
11
}
12